/*
 * @Author: 杨伟韦
 * @Date: 2025-04-19 14:40:00
 * @LastEditors: 杨伟韦
 * @LastEditTime: 2025-04-19 14:40:00
 * @Description: 相册编辑hooks
 */
import { computed, reactive } from 'vue';
import { getAlbumTemplateDetail } from '@/api/home';
import { to } from '@/utils/await-to';
import { Message } from 'view-ui-plus';

export default function useAlbum() {
  const state = reactive({
    mAlbums: [] as any[], // 当前相册所有的图片和数据列表
    mSelectAlbum: null as any, // 当前选中的相册图片
    albumLoading: false, // 加载相册数据
  });
  const canvas = new fabric.Canvas('canvas-cache');

  /**
   * 初始化相册数据
   */
  const initAlbum = async ({ id }: any, successCallback?: any) => {
    state.albumLoading = true;
    const [err, res] = await to(getAlbumTemplateDetail({ templateId: id }), null);
    state.albumLoading = false;

    if (err) return Message.error(err.msg || '获取相册数据失败');

    const { code, msg, data } = res?.data || {};
    if (code !== 200) return Message.error(msg || '获取相册数据失败');
    // console.log(JSON.parse(data.templateJson));
    const _data = [mock];

    const imageData = await Promise.all(_data.map((item) => createImgByJSON(item)));
    console.log(imageData);

    _data.forEach((item, index) => {
      const { src, width, height } = imageData[index] as any;
      item.src = src;
      item.width = width;
      item.height = height;
    });

    console.log(_data);
    state.mAlbums = _data;

    successCallback?.();
  };

  const widthImg = 150,
    heightImg = 225;
  // 根据相册数据初始化图片
  const createImgByJSON = async (data: any) => {
    return new Promise((resolve) => {
      async function exec() {
        const { width = widthImg, height = heightImg } = data.attributes.json?.objects?.[0] || {};
        const _width = widthImg;
        const _heigth = (_width / width) * height;

        const img = await getImage(data.attributes.json);

        const newData = {
          width: _width,
          height: _heigth,
          src: img,
        };
        resolve(newData);
      }

      exec();
    });
  };

  // 生成图片
  const getImage = (json: any) => {
    return new Promise((resolve) => {
      const { width, height } = json?.objects?.[0] || {};
      canvas.setDimensions({
        width: width,
        height: height,
      });
      canvas.loadFromJSON(json, () => {
        resolve(canvas.toDataURL({ format: 'png', quality: 1 }));
      });
    });
  };

  /**
   * 添加相册图片
   */
  const onAddAlbum = (data: any) => {
    state.mAlbums.push(data);
  };

  /**
   * 删除相册图片
   */
  const onDeleteAlbum = (id: any) => {
    state.mAlbums = state.mAlbums.filter((item: any) => item.id !== id);
  };

  /**
   * 修改相册图片
   */
  const onUpdateAlbum = (data: any) => {
    state.mAlbums = state.mAlbums.map((item: any) => {
      if (item.id === data.id) {
        return data;
      }
      return item;
    });

    return state.mAlbums;
  };

  /**
   * 选中相册某张图片
   */
  const onSelectAlbum = (id: string) => {
    console.log(id, 'idd');
    state.mSelectAlbum = state.mAlbums.find((item: any) => item.id === id);
  };

  // 获取当前选中的照片
  const getSelectAlbum = () => state.mSelectAlbum;

  const albums = computed(() => [...state.mAlbums]);
  const selectAlbum = computed(() => state.mSelectAlbum);
  const albumLoading = computed(() => state.albumLoading);

  return {
    initAlbum,
    onAddAlbum,
    onDeleteAlbum,
    onUpdateAlbum,
    onSelectAlbum,
    getSelectAlbum,
    albums,
    selectAlbum,
    albumLoading,
  };
}

const mock = {
  id: 2,
  attributes: {
    name: '假日快乐',
    desc: null,
    json: {
      objects: [
        {
          id: 'workspace',
          rx: 0,
          ry: 0,
          top: 0,
          fill: 'rgba(255,255,255,1)',
          left: 0,
          type: 'rect',
          angle: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 1242,
          height: 1660,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: false,
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: false,
          hasControls: false,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '7e1a373b-3e99-4f65-ab6c-7e909fef6cc5',
          src: 'https://newapi.kuaitu.cc/uploads/1750053515342_b2b1152b03.png',
          top: -571,
          fill: 'rgb(0,0,0)',
          left: -1510,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 3776,
          height: 3255,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '0c439c94-2df7-4da4-95e1-0b53a67b443d',
          src: 'https://newapi.kuaitu.cc/uploads/1750053547023_d7a5fe437d.png',
          top: 72,
          fill: 'rgb(0,0,0)',
          left: 82,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 1050,
          height: 167,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '6e9e9a7f-e4ee-4b71-beeb-3e14ff49cbfe',
          src: 'https://newapi.kuaitu.cc/uploads/1750053547453_4ba5a06248.png',
          top: 374,
          fill: 'rgb(0,0,0)',
          left: 184,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 843,
          height: 1146,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '025363b5-e805-4854-94aa-eb9065eb8433',
          src: 'https://newapi.kuaitu.cc/uploads/1750053548550_016426277e.png',
          top: 404,
          fill: 'rgb(0,0,0)',
          left: 222,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 768,
          height: 1086,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '29a003db-bdc6-4954-89be-17fd140138de',
          src: 'https://newapi.kuaitu.cc/uploads/1750053554010_40db7d5a5b.png',
          top: 288,
          fill: 'rgb(0,0,0)',
          left: 96,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 696,
          height: 47,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '461b6053-4bd2-48bb-9e7b-4da7e943c91d',
          src: 'https://newapi.kuaitu.cc/uploads/1750053554592_7c56aa9165.png',
          top: 1537,
          fill: 'rgb(0,0,0)',
          left: 55,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 47,
          height: 53,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'c9b6fdaa-f79a-411c-9c3f-393815c5ad11',
          src: 'https://newapi.kuaitu.cc/uploads/1750053554981_fcd14aeb2d.png',
          top: 328,
          fill: 'rgb(0,0,0)',
          left: 1047,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 151,
          height: 135,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '706c73fd-9750-4c0f-af2b-409f9d6a1c99',
          src: 'https://newapi.kuaitu.cc/uploads/1750053555398_49f1d93d4d.png',
          top: 1372,
          fill: 'rgb(0,0,0)',
          left: 276,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 690,
          height: 182,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '0d8f8ee8-0e53-4de5-92a3-4a37bedb2d14',
          top: 1415,
          fill: 'rgb(0, 0, 0)',
          left: 341,
          name: '满300立减50元\n\n',
          path: null,
          text: '满300立减50元\r\r',
          type: 'textbox',
          angle: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 668,
          height: 90.4,
          scaleX: 1,
          scaleY: 1,
          shadow: '',
          stroke: null,
          styles: [],
          evented: true,
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          editable: true,
          fillRule: 'nonzero',
          fontSize: 80,
          minWidth: 20,
          overline: false,
          pathSide: 'left',
          direction: 'ltr',
          fontStyle: 'normal',
          pathAlign: 'baseline',
          textAlign: 'left',
          underline: false,
          fontFamily: '站酷快乐体',
          fontWeight: 'normal',
          lineHeight: 1.16,
          paintFirst: 'fill',
          selectable: true,
          charSpacing: 0,
          hasControls: true,
          linethrough: false,
          strokeWidth: 1,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          pathStartOffset: 0,
          splitByGrapheme: true,
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          textBackgroundColor: '',
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'b936e510-e71c-4768-b791-f3c31eaf74ce',
          top: 483,
          fill: 'rgb(0, 0, 0)',
          left: 1026,
          name: '05/22\n\n',
          path: null,
          text: '05/22\r\r',
          type: 'textbox',
          angle: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 261,
          height: 153.7704,
          scaleX: 1,
          scaleY: 1,
          shadow: '',
          stroke: null,
          styles: [],
          evented: true,
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          editable: true,
          fillRule: 'nonzero',
          fontSize: 63,
          minWidth: 20,
          overline: false,
          pathSide: 'left',
          direction: 'ltr',
          fontStyle: 'normal',
          pathAlign: 'baseline',
          textAlign: 'left',
          underline: false,
          fontFamily: '站酷快乐体',
          fontWeight: 'normal',
          lineHeight: 1.16,
          paintFirst: 'fill',
          selectable: true,
          charSpacing: 0,
          hasControls: true,
          linethrough: false,
          strokeWidth: 1,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          pathStartOffset: 0,
          splitByGrapheme: true,
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          textBackgroundColor: '',
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'c4cf8b1b-f635-4e28-b283-a3944e3b143e',
          src: 'https://newapi.kuaitu.cc/uploads/1750053555727_26636afaa2.png',
          top: 1137,
          fill: 'rgb(0,0,0)',
          left: 530,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 414,
          height: 244,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'f935eb6f-97b3-4cb3-a342-1f0aea4d0a5b',
          src: 'https://newapi.kuaitu.cc/uploads/1750053556071_f41a7f0109.png',
          top: 379,
          fill: 'rgb(0,0,0)',
          left: 73,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 162,
          height: 139,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '37900b74-9886-4daa-9a31-fc343b887675',
          src: 'https://newapi.kuaitu.cc/uploads/1750053556287_d10b6949ae.png',
          top: 1323,
          fill: 'rgb(0,0,0)',
          left: 838,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 179,
          height: 99,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'fc55317d-6219-4a94-b8a0-870a3e51c0c6',
          src: 'https://newapi.kuaitu.cc/uploads/1750053556517_0b9f7564e9.png',
          top: 541,
          fill: 'rgb(0,0,0)',
          left: 1022,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 201,
          height: 127,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'acd98854-63a9-4ae1-b732-ac6dd8027453',
          src: 'https://newapi.kuaitu.cc/uploads/1750053557049_badaf56c25.png',
          top: 1007,
          fill: 'rgb(0,0,0)',
          left: 62,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 32,
          height: 516,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '578a41d1-8b01-4f1d-9740-b04b7cfae3cd',
          src: 'https://newapi.kuaitu.cc/uploads/1750053557288_d9d77c2e2c.png',
          top: 524,
          fill: 'rgb(0,0,0)',
          left: 56,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 45,
          height: 458,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'e6af09a1-391f-44d3-9fdf-c72b2ec01ec9',
          src: 'https://newapi.kuaitu.cc/uploads/1750053557666_b48a9152aa.png',
          top: 1454,
          fill: 'rgb(0,0,0)',
          left: 1039,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 140,
          height: 140,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: '798009b9-089a-497a-953f-bcd3578a89f5',
          top: 1283,
          fill: 'rgb(0, 0, 0)',
          left: 1082,
          name: '每周\n二更\n新\n\n',
          path: null,
          text: '每周\r二更\r新\r\r',
          type: 'textbox',
          angle: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 118,
          height: 150.064,
          scaleX: 1,
          scaleY: 1,
          shadow: '',
          stroke: null,
          styles: [],
          evented: true,
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          editable: true,
          fillRule: 'nonzero',
          fontSize: 40,
          minWidth: 20,
          overline: false,
          pathSide: 'left',
          direction: 'ltr',
          fontStyle: 'normal',
          pathAlign: 'baseline',
          textAlign: 'left',
          underline: false,
          fontFamily: '站酷快乐体',
          fontWeight: 'normal',
          lineHeight: 1.16,
          paintFirst: 'fill',
          selectable: true,
          charSpacing: 0,
          hasControls: true,
          linethrough: false,
          strokeWidth: 1,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          pathStartOffset: 0,
          splitByGrapheme: true,
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          textBackgroundColor: '',
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'cdb8be76-99ef-4495-b8b4-4b5a89ddb966',
          src: 'https://newapi.kuaitu.cc/uploads/1750053557972_e35e5dc0c1.png',
          top: 560,
          fill: 'rgb(0,0,0)',
          left: 1086,
          name: '',
          type: 'image',
          angle: 0,
          cropX: 0,
          cropY: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 99,
          height: 45,
          scaleX: 1,
          scaleY: 1,
          shadow: null,
          stroke: null,
          evented: true,
          filters: [],
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          fillRule: 'nonzero',
          paintFirst: 'fill',
          selectable: true,
          crossOrigin: 'anonymous',
          hasControls: true,
          strokeWidth: 0,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          globalCompositeOperation: 'source-over',
        },
        {
          id: 'd3219f92-c4e2-4f37-99cf-48c430b111ac',
          top: 569,
          fill: 'rgb(255, 255, 255)',
          left: 1098,
          name: 'TIME\n\n',
          path: null,
          text: 'TIME\r\r',
          type: 'textbox',
          angle: 0,
          flipX: false,
          flipY: false,
          skewX: 0,
          skewY: 0,
          width: 136,
          height: 31.64,
          scaleX: 1,
          scaleY: 1,
          shadow: '',
          stroke: null,
          styles: [],
          evented: true,
          opacity: 1,
          originX: 'left',
          originY: 'top',
          version: '5.5.2',
          visible: true,
          editable: true,
          fillRule: 'nonzero',
          fontSize: 28,
          minWidth: 20,
          overline: false,
          pathSide: 'left',
          direction: 'ltr',
          fontStyle: 'normal',
          pathAlign: 'baseline',
          textAlign: 'left',
          underline: false,
          fontFamily: '站酷快乐体',
          fontWeight: 'normal',
          lineHeight: 1.16,
          paintFirst: 'fill',
          selectable: true,
          charSpacing: 0,
          hasControls: true,
          linethrough: false,
          strokeWidth: 1,
          strokeLineCap: 'butt',
          strokeUniform: false,
          strokeLineJoin: 'miter',
          backgroundColor: '',
          pathStartOffset: 0,
          splitByGrapheme: true,
          strokeDashArray: null,
          strokeDashOffset: 0,
          strokeMiterLimit: 4,
          textBackgroundColor: '',
          globalCompositeOperation: 'source-over',
        },
      ],
      version: '5.5.2',
      clipPath: {
        rx: 0,
        ry: 0,
        top: 0,
        fill: 'rgba(255,255,255,1)',
        left: 0,
        type: 'rect',
        angle: 0,
        flipX: false,
        flipY: false,
        skewX: 0,
        skewY: 0,
        width: 1242,
        height: 1660,
        scaleX: 1,
        scaleY: 1,
        shadow: null,
        stroke: null,
        evented: true,
        opacity: 1,
        originX: 'left',
        originY: 'top',
        version: '5.5.2',
        visible: true,
        fillRule: 'nonzero',
        paintFirst: 'fill',
        selectable: true,
        hasControls: true,
        strokeWidth: 0,
        strokeLineCap: 'butt',
        strokeUniform: false,
        strokeLineJoin: 'miter',
        backgroundColor: '',
        strokeDashArray: null,
        strokeDashOffset: 0,
        strokeMiterLimit: 4,
        globalCompositeOperation: 'source-over',
      },
    },
    sort: 10000,
    price: null,
    proInfo: null,
    createdAt: '2025-06-16T05:59:20.386Z',
    updatedAt: '2025-06-16T05:59:22.054Z',
    publishedAt: '2025-06-16T05:59:22.050Z',
  },
};
